package com.example.result.kotlin.base

import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.shouldBe

class TextTest : StringSpec({
    "小说文本按章节切割" {
        val value = """
            aaa
            第1章 aaaa
            aaa
            第2章 bbb
            bbb
        """.trimIndent()
        val target = value.split("\n(?=\\s*第.{1,6}[章节].{0,20}\n)".toRegex())
        target.size shouldBe 3
    }
    "文字编码检测" {
    }
    "关键词切分"{
        val data = "abccdc"
        data.split("c") shouldBe arrayListOf("ab","","d","")
        data.split("c").joinToString("c") shouldBe data
    }
})

